﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Interfaces.RepositoryModels.InternalModels.EconomicInformationModels;
using SQLRepositories;

namespace DataProviderIntegrationTests.RepositoryTests
{
    public static class TestsHelper
    {
        public static void CreateEconomicTestData()
        {
            var context = new DBEconomicInformationServiceContext();
            var industries1 = new List<IndustryModel>();
            var industries2 = new List<IndustryModel>();
            var companies1 = new List<CompanyModel>();
            var companies2 = new List<CompanyModel>();
            var quoteis1 = new List<QuoteModel>();
            var quoteis2 = new List<QuoteModel>();
            var sectors = new List<SectorModel>
                {
                    new SectorModel
                        {
                            Id = Guid.NewGuid(),
                            Name = "Sector1",
                            ChangedDate = DateTime.Now,
                            CreatedDate = DateTime.Now,
                            Industries = industries1
                        },
                    new SectorModel
                        {
                            Id = Guid.NewGuid(),
                            Name = "Sector1",
                            ChangedDate = DateTime.Now,
                            CreatedDate = DateTime.Now,
                            Industries = industries2
                            
                        }
                };
               industries1.Add(new IndustryModel
                {
                    Id = Guid.NewGuid(),
                    Key = 112,
                    Sector = sectors[0],
                    Name = "Test",
                    ChangedDate = DateTime.Now,
                    CreatedDate = DateTime.Now,
                    Companies = companies1

                });
               industries2.Add(new IndustryModel
               {
                   Id = Guid.NewGuid(),
                   Key = 111,
                   Sector = sectors[1],
                   Name = "Test",
                   ChangedDate = DateTime.Now,
                   CreatedDate = DateTime.Now,
                   Companies = companies2
               });
               companies1.Add(new CompanyModel
                   {
                       Id = Guid.NewGuid(),
                       ChangedDate = DateTime.Now,
                       CreatedDate = DateTime.Now,
                       Name = "Test",
                       Symbol = "sym",
                       Industry = industries1[0],
                       Quoteis = quoteis1
                   });
                companies2.Add(new CompanyModel
                    {
                        Id = Guid.NewGuid(),
                        ChangedDate = DateTime.Now,
                        CreatedDate = DateTime.Now,
                        Name = "Test",
                        Symbol = "sym",
                        Industry = industries2[0],
                        Quoteis = quoteis2
                    });
                quoteis1.Add(new QuoteModel
                   {
                       Id = Guid.NewGuid(),
                       Company = companies1[0],
                       ChangedDate = DateTime.Now,
                       CreatedDate = DateTime.Now
                   });
                quoteis2.Add(new QuoteModel
                {
                    Id = Guid.NewGuid(),
                    Company = companies2[0],
                    ChangedDate = DateTime.Now,
                    CreatedDate = DateTime.Now
                });
            context.Sectors.Add(sectors[0]);
            context.Sectors.Add(sectors[1]);
            context.SaveChanges();
        }
    }
}
